/**
 * Email ：huangyijia138@qq.com
 * Des：
 *
 * @description: 213
 * @author: huangjiajia
 * @create: 2025-01-20 12:52
 **/
public class User2 {

    private int age;

    public int getAge() {
        return age;
    }

  /*  public void getAge(int num) {
        this.age = num;
        if (num <= 0 || num > 100) {
            System.out.println("对不起，您的年龄值不合法");
            return;
        }
        age = num;

    }*/

    //java的就近原则
    public void setAge(int age) {


        if (age <= 0 || age > 100) {
            System.out.println("对不起，您的年龄值不合法");
            return;


        }
        this.age = age;
    }

}

